#!/bin/bash
for file in `$1 -o /dev/null -Wl,-M "${@:2}" 2>/dev/null | grep '^LOAD ' | sed 's/^LOAD //'`; do
  nm "$file" -g --defined-only 2>/dev/null
  nm "$file" -D -g --defined-only 2>/dev/null
done | awk '{print $3; }' | sort | uniq
